import defaultSettings from '@/settings'
import i18n from '@/lang'
import Router from '@/router'
import {
  getLanguage
} from '@/lang/index'

const title = defaultSettings.title

// 切换logo
export default function getPageTitle(key, fullName) {
  const realTitle = getLanguage() === 'en' ? 'JSBOS' : getLanguage() === 'zhtw' ? 'JSBOS軟件開發平臺' : title
  const hasKey = i18n.te(`route.${key}`)

  let settingsName = '智行-数字化管理平台'

  if (window.location.href.indexOf('454556140475292421') != -1) {
    settingsName = '智行-数字化管理平台'
  }
  if (window.location.href.indexOf('contract-login') != -1) {
    settingsName = '智行-数字化管理平台'
  }

  if (hasKey) {
    const pageName = i18n.t(`route.${key}`)
    console.log(`${pageName} - ${settingsName}`, Router)
    return `${pageName} - ${settingsName}`
    // return `${pageName} - ${realTitle}`
  }
  return fullName ? `${settingsName}-${fullName}` : settingsName
}
